package com.empire.module.member.dal.mysql.casepersonrelation;

import com.empire.framework.common.pojo.PageResult;
import com.empire.framework.mybatis.core.mapper.BaseMapperX;
import com.empire.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.empire.module.member.controller.admin.casepersonrelation.vo.CasePersonRelationPageReqVO;
import com.empire.module.member.dal.dataobject.casepersonrelation.CasePersonRelationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 案件-人员关系 Mapper
 *
 * @author 主席大人
 */
@Mapper
public interface CasePersonRelationMapper extends BaseMapperX<CasePersonRelationDO> {

    default PageResult<CasePersonRelationDO> selectPage(CasePersonRelationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CasePersonRelationDO>()
                .eqIfPresent(CasePersonRelationDO::getCaseId, reqVO.getCaseId())
                .eqIfPresent(CasePersonRelationDO::getPersonId, reqVO.getPersonId())
                .orderByDesc(CasePersonRelationDO::getId));
    }

}